package com.js.web.controller;

import com.js.core.entity.result.ResultBean;
import com.js.core.entity.User;
import com.js.core.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @ClassName UserController
 * @Description TODO
 * @Author mazp
 * @Date 2025/7/22 19:08
 */
@RequestMapping("/user")
@RestController
public class UserController {

    @Resource
    private UserService userService;

    private static Logger log= LoggerFactory.getLogger(ArticleController.class);

    @RequestMapping("/queryById")
    public ResultBean queryById(String id) {
        ResultBean resultBean = new ResultBean();
        try{
            User user = userService.getById(id);
            resultBean.setData(user);
        }catch (Exception e){
            log.error(e.getMessage());
            resultBean.setCode(ResultBean.CODE_ERROR);
        }
        return resultBean;
    }
}
